<!-- 引入核心页面 -->
<th:block th:replace="module/gikam/workspace"/>
<script th:src="@{/static/baseline/common/lims-global-function-list.js}"></script>

<!-- 框架配置 -->
<script>
    Gikam.setCompConfig({
        grid: {
            page: false,
            checkOneOnActive: true,
            editorInvisible: true,
            toolbarAlign: 'left',
            pageSize: 100,
            pageList: [100, 200, 500, "grid.all.data"],
            export: {
                asyncExportExcel: false
            },
        },
        window: {
            showTitle: false,
            toolbarAlign: 'left'
        },
        uploader: {
            toolbarAlign: 'left'
        },
        /*        workflow: {
                    submit: function (param) {
                        param.formatterToolbar = (toolbar, type, formId) => {
                            toolbar.forEach(b => {
                                if (b.text === 'GIKAM.BUTTON.CONFIRM') {
                                    b.class = 'blue'
                                    b.icon = 'save'
                                    b.color = 'white'
                                } else if (b.text === 'GIKAM.BUTTON.CANCEL') {
                                    b.icon = 'back'
                                }
                            })
                            return toolbar
                        }
                    }
                }*/
    });
</script>

<!-- 页面初始化 -->
<script th:inline="javascript">
    let localeLang = Gikam.component.FrontI18N.getLocale();
    let title = Gikam.propI18N('SYSTEM.TITLE');
    let logoUrl = '/static/baseline/img/sys_logo.png';
    let logoUrlMain = '/static/baseline/img/sys_logo.png';
    let configBean = {}
    Gikam.getTextSync(Gikam.printf(IFM_CONTEXT + '/open/basemodule/basedata/pageconfigs' + '/get-config/{id}', {id: 2})).done(req => {
        configBean = JSON.parse(req)
    })
    if (configBean.logoUrl) {
        logoUrl = configBean.logoUrl
    }
    if (configBean.logoUrlMain) {
        logoUrlMain = configBean.logoUrlMain
    }
    if (!window.localStorage.locale || window.localStorage.locale === 'zh-CN' || window.localStorage.locale === 'zh-cn') {
        if (configBean.title) {
            title = configBean.title
        }
    } else {
        if (configBean.enTitle) {
            title = configBean.enTitle
        }
    }

    window.workspace = new IndexPage({
        xIconUrl: IFM_CONTEXT + '/static/baseline/img/tab_logo_baseline.png',
        title: title,
        activeMenuId: Gikam.getElParam([[${param}]]).activeMenuId,
        logo: IFM_CONTEXT + logoUrl,
        showFullScreen: true,
        expandFirstSubMenu: true,
        enableInstantMessage: true,
        fullScreenLogo: IFM_CONTEXT + logoUrlMain,
        onEnterFullScreen: function () {
            Gikam.enterFullScreen(); // 浏览器进入全屏
            workspace.window.enterFullScreen(); // 业务页面进入全屏，不包括菜单栏
        },
        dblExitFullScreen: function () {
            //双击退出浏览器全屏
            const {clientWidth} = document.documentElement;
            const {clientHeight} = document.documentElement;
            if (clientWidth / clientHeight < 1.8) {
                if (document.exitFullscreen) {
                    document.exitFullscreen();
                } else if (document.msExitFullscreen) {
                    document.msExitFullscreen();
                } else if (document.mozCancelFullScreen) {
                    document.mozCancelFullScreen();
                } else if (document.webkitExitFullscreen) {
                    document.webkitExitFullscreen();
                }
            }
        },
        navIconFormatter: function (navs) {
            var color = '#ffffff';
            var greyColorStyle = ['snowlotus', 'peony', 'tulip', 'datura'];
            if (greyColorStyle.indexOf(this.pageStyle) > -1) {
                color = '#fff';
            }
            var locale = Gikam.component.FrontI18N.getLocale();
            var lang = '中';
            if ((typeof (locale) == "undefined") || !locale || locale == 'zh-CN' || locale == 'zh-cn') {
                lang = 'En';
            } else {
                lang = '中';
            }
            // 日程提醒
            var num = ''
            var myTaskUrl = IFM_CONTEXT + '/secure/core/module/my-tasks/queries'
            Gikam.postSync(myTaskUrl, Gikam.getJsonWrapper({
                f: {
                    createdById_SEQ: window.localStorage.loginUserId,
                    // taskStartTime_TLOE: Gikam.DateUtils.formatter(new Date(), 'yyyy-MM-dd hh:mm:ss'),
                    taskEndTime_TGOE: Gikam.DateUtils.formatter(new Date(), 'yyyy-MM-dd hh:mm:ss')
                }
            })).done(req => {
                if (req.rows && req.rows.length > 0) {
                    num = '<span id="myTask-todo-num" class="myTask-todo-num">' + req.rows.length + '</span>'
                } else {
                    num = '<span id="myTask-todo-num" class="myTask-todo-num"></span>'
                }
            })
            // 这里8801是日程菜单的id
            navs = navs.concat({
                // 尝试换成图标
                template: '<div id="myTask"  class="myTask" onclick="window.workspace.activeNodeById(8801)">' + '<svg t="1680861315169" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2846" width="20" height="20"><path d="M918.064784 956.685895 106.693486 956.685895c-14.145162 0-25.611308-11.466146-25.611308-25.611308L81.082178 191.053314c0-14.145162 11.467169-25.611308 25.611308-25.611308l811.372322 0c14.145162 0 25.611308 11.467169 25.611308 25.611308l0 740.02025C943.677115 945.219749 932.209946 956.685895 918.064784 956.685895zM132.304793 905.462257l760.148683 0L892.453477 216.665645 132.304793 216.665645 132.304793 905.462257z" p-id="2847" fill="#000000"></path><path d="M915.399071 410.394904 109.150444 410.394904c-14.145162 0-25.611308-11.467169-25.611308-25.611308s11.467169-25.611308 25.611308-25.611308l806.248627 0c14.145162 0 25.611308 11.467169 25.611308 25.611308S929.544233 410.394904 915.399071 410.394904z" p-id="2848" fill="#000000"></path><path d="M248.687454 313.735447c-14.145162 0-25.611308-11.467169-25.611308-25.611308L223.076146 91.962481c0-14.145162 11.467169-25.611308 25.611308-25.611308s25.611308 11.467169 25.611308 25.611308l0 196.160635C274.299785 302.269301 262.832615 313.735447 248.687454 313.735447z" p-id="2849" fill="#000000"></path><path d="M786.618033 313.735447c-14.145162 0-25.611308-11.467169-25.611308-25.611308L761.006725 91.962481c0-14.145162 11.466146-25.611308 25.611308-25.611308s25.611308 11.467169 25.611308 25.611308l0 196.160635C812.229341 302.269301 800.763195 313.735447 786.618033 313.735447z" p-id="2850" fill="#000000"></path><path d="M468.548884 770.868839c-6.792707 0-13.307074-2.698458-18.110473-7.500834l-87.661525-87.663572c-10.001795-10.000771-10.001795-26.218128 0-36.220946 10.002818-10.000771 26.219151-10.001795 36.220946 0.001023l69.551052 69.552076 157.211555-157.213601c10.002818-10.000771 26.219151-10.000771 36.220946 0 10.001795 10.001795 10.001795 26.219151 0.001023 36.220946l-175.323051 175.324074C481.855958 768.17038 475.34159 770.868839 468.548884 770.868839z" p-id="2851" fill="#000000"></path></svg>' + num + '</div>'
            })
            // 中英文切换按钮
            /*            navs = navs.concat({
                            template: '<div id="changeLang"  class="changeLang" onclick="window.workspace.changeLang()">' + lang + '</div>'
                        })*/
            return navs
        },
        //Auth2单点跳出登录返回的URL
        /* sessionTimeout : function (){
        	Gikam.postText('core/module/sys/logout').done(function() {
                var value = [[${@msConfigHelper.getCacheValue("OAUTHLOGIN")}]];
                top.location.href = value;
            })
        },

        logout : function (){
            Gikam.postText('core/module/sys/logout').done(function() {
                var value = [[${@msConfigHelper.getCacheValue("OAUTHLOGIN")}]];
                top.location.href = value;
            })
        },  */
        // 水印
        onUserLoadSuccess: function (user) {
            Gikam.watermark({
                text: user.userName + ' ' + user.id + '<br>' + user.ext$.logintime,
                fontSize: 20,
                rotate: 330,
                color: 'rgba(128,128,128,0.1)',
                textAlign: 'center'
            });
            // workspace.hideIndexPanelConfig();
        },
        // 侧边菜单栏
        sideBar: {
            defaultWidth: 230,
            manualStretch: true
        },
        sideAutoToggle: false,

        // 手动生成样式
        beforeCreate() {
            var cssText = getStyle()
            var style = document.createElement('style');
            style.innerHTML = cssText;
            console.log(style)
            document.head.appendChild(style);
        }
    });

    function getStyle() {
        var color = workspace.options.skin || 'blue';
        return `
		 	body.component .layout .region > .expand-collapse.vertical .expand-round span,
            body.component .layout .region > .expand-collapse.vertical .expand-round {
                background-color: ${color}!important;
                color: #fff!important;
            }

            body.component .tab.only-one > .tab-header > .content-wrapper > ul > li.active {
                position: relative;
                border: none;
                font-size: 14px;
                color: #fff!important;
                font-weight: 600;
                background-color: ${color}!important;
            }

            body.component .layout .region > .expand-collapse .expand-round span {
                position: relative;
                border: none;
                font-size: 14px;
                color: #fff!important;
                font-weight: 600;
                background-color: ${color}!important;
            }

            body.component .confirm-dialog > .confirm-container > .footer > button.yes,
            body.component .alert > .alert-container footer .confirm-btn {
                background: ${color}!important;
                border: ${color}!important;
                padding: 3px 10px!important;
                height: 26px!important;
            }

            body.component .confirm-dialog > .confirm-container > .footer > button.yes:hover,
            body.component .alert > .alert-container footer .confirm-btn:hover {
                background: ${color}!important;
            }

            .confirm-dialog > .confirm-container > .footer > button.no::before {
                color: ${color}!important;
            }

            .btn-container>.button.blue[data-v-1c2bb9c4], .btn-container>.button.primary[data-v-1c2bb9c4] {
                background-color: ${color}!important;
                color: #fff!important;
                border: 1px solid ${color}!important;
                overflow: hidden!important;
            }
		 `;
    }

    window.workspace.changeLang = function () {
        var locale = Gikam.component.FrontI18N.getLocale();
        if ((typeof (locale) == "undefined") || locale == null || locale == 'zh-cn') {
            Gikam.component.FrontI18N.setLocale('en-US');
        } else {
            Gikam.component.FrontI18N.setLocale('zh-cn');
        }
    }

    Gikam.jQuery('body.component .tab.only-one > .tab-header > .content-wrapper > ul > li.active').css('background-color', workspace.options.skin)
    Gikam.jQuery('body.component .layout .region > .expand-collapse .expand-round span').css('background-color', workspace.options.skin)
</script>
<style>

    :root {
        /*--main-color: #00AC84;*/
        --main-color: #00AC84;
    }

    #pass-rate-btn .button {
        border: 1px solid #d9d9d9 !important;
    }

    .main-container.blue > header > .top-toolbar {
        background-image: none;
        background-color: #0054A7;
    }

    .main-container > header > .top-toolbar > .nav-logo-text > .text {
        font-style: normal;
        font-size: 20px;
    }

    .main-container > header > .top-toolbar > .sys-info {
        color: black
    }

    body.component .sunway-radio.readonly .sunway-radio-option.active .sunway-radio-input:before {
        background: #AAA
    }

    .btn-container > .button > .icon.white:before {
        color: white
    }

    /*按钮尺寸颜色*/
    /*    body.component .confirm-dialog > .confirm-container > .footer > button.yes,
        body.component .alert > .alert-container footer .confirm-btn {
            background: #007aff;
            border: #007aff;
            padding: 3px 10px;
            height: 26px;
        }*/

    /*按钮尺寸颜色*/
    body.component .confirm-dialog > .confirm-container > .footer > button.no {
        padding: 3px 10px;
        height: 26px;
    }

    body.component .confirm-dialog > .confirm-container > .footer > button.active {
        box-shadow: 0 0 0 0
    }

    /*确认按钮深蓝色改成浅蓝色*/
    /*body.component .confirm-dialog > .confirm-container > .footer > button.yes:hover,
    body.component .alert > .alert-container footer .confirm-btn:hover {
        background: #007aff;
    }*/

    /*取消按钮改成白色*/
    body.component .confirm-dialog > .confirm-container > .footer > button.no:hover {
        background: white;
    }

    /*确认按钮前面保存图标*/
    .confirm-dialog > .confirm-container > .footer > button.yes::before,
    .component .alert > .alert-container footer .confirm-btn::before {
        color: white;
        content: url('');
        box-sizing: border-box;
        height: 16px;
        width: 16px;
        margin-right: 2px;
        /*border-radius: 5px;*/
    }

    /*取消按钮前面返回图标*/
    .confirm-dialog > .confirm-container > .footer > button.no::before {
        /*color: #007aff;*/
        content: url('');
        box-sizing: border-box;
        height: 16px;
        width: 16px;
        margin-right: 2px;
        /*border-radius: 5px;*/
    }


    /*表格样式，从 prototype 搬运*/
    .grid > .grid-body table > tbody > tr > td {
        height: 18px;
        padding: 0;
        font-size: 12px;
        color: rgba(0, 0, 0, 0.98);
        text-align: left;
        border-right: 1px solid #eee;
        line-height: 18px;
        font-family: Microsoft YaHei, serif;
    }

    .text-input .readonly-text, .text-input input {
        height: 18px;
        padding-left: 2px;
        font-size: 12px;
        color: rgba(0, 0, 0, 0.98);
        text-align: left;
        border-right: 1px solid #eee;
        line-height: 18px;
        font-family: Microsoft YaHei, serif;
    }

    /*gird选择框；*/
    .choose-input .content-wrapper {
        height: 18px;
        padding: 0;
        font-size: 12px;
        color: rgba(0, 0, 0, 0.98);
        text-align: left;
        line-height: 18px;
        font-family: Microsoft YaHei, serif;
    }

    .select .readonly-text, .select .select-container {
        color: rgba(0, 0, 0, 0.98);
    }

    .main-container > header > .page-switch-tab > .nav-icon {
        width: 26px;
        height: 26px;
    }

    /*toolbar*/
    .grid > .toolbar, .grid > .toolbar > .operation {
        height: 20px;
    }

    table > thead > tr > th[class] {
        height: 28px;
        background-color: lightgray;
        font-weight: bold;
    }

    /*grid输入框行高设置*/
    .text-input .readonly-text, .text-input input {
        height: 25px;
    }

    table > thead > tr > th > div span {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    .main-container > header > .top-toolbar {
        height: 36px;
    }

    .main-container > header > .top-toolbar > ul.nav-tab-list > li {
        line-height: 36px;
    }

    main-container > header {
        height: 26px;
    }

    .main-container > header > .page-switch-tab {
        height: 26px;
    }

    .main-container > header > .page-switch-tab > .page-switch-container {
        height: 26px;
    }

    .main-container > header > .page-switch-tab > .page-switch-container > .items {
        line-height: 26px;
    }

    .main-container > header > .page-switch-tab > .more {
        height: 26px;
    }

    .main-container > header > .page-switch-tab > .home {
        height: 26px;
    }

    .cuckoo .cuckoo-bg .cuckoo-content .entry-input .entry-input_button {
        background: #45C1F9;
    }

    .cuckoo .cuckoo-bg .cuckoo-content .logo-in {
        width: 245px;
    }

    .grid > .grid-body table > tbody > tr > td, .grid table > thead > tr > th {
        border-right: 1px solid #d9d9d9;
        border-right-color: rgb(217, 217, 217);
        border-bottom: 1px solid #d9d9d9;
        border-bottom-width: 1px;
        border-bottom-style: solid;
        border-bottom-color: rgb(217, 217, 217);
    }

    .panel > section > .form-group {
        margin-bottom: 5px;
    }

    .field, .field .field-container > div:not(.checkbox), .field .field-container > input {
        min-height: 23px;
    }

    .panel .field .readonly .link-text, .panel .field .readonly:not(.textarea) .readonly-text {
        line-height: 24px;
        height: 24px;
    }

    .date-input .readonly-text, .date-input input {
        color: rgba(0, 0, 0, 1.65);
    }

    .link {
        color: rgba(0, 122, 255, 1.65);
    }

    .select .readonly-text, .select .select-container {
        color: rgba(0, 0, 0, 1.98);
        height: 24px;
    }

    .form .form-group .title .text.hasRedStar:before, .form .form-group .title .text.titleHighlight:before {
        content: "*";
        top: 0px;
    }

    table > thead > tr > th > div span.hasRedStar:before, table > thead > tr > th > div span.titleHighlight:before {
        content: "*";
        top: 3px;
    }

    tr.hidden.checked {
        background-color: greenyellow !important;
    }

    .grid > .toolbar, .grid > .toolbar > .operation {
        height: 25px;
    }

    .grid > .grid-body table > tbody > tr.active {

    }

    .choose-input .content-wrapper {
        height: 32px;
        line-height: 32px;
        font-family: Microsoft YaHei, serif;
    }

    tr.total-row div {
        line-height: 32px;
        align-content: center;
        color: red;
        font-weight: bold;
        text-align: right;
    }

    .grid > .toolbar > .operation > .item > .form-container > .form .form-group .field {
        height: 24px;
    }

    .sunway-radio.sunway-radio_border {
        height: 24px;
        min-height: 24px;
    }

    element.style {
    }

    .sunway-radio .sunway-radio-option {
        height: 24px;
        line-height: 20px;
    }

    table > thead > tr > th {
        height: 28px;
    }

    .main-container > header > .top-toolbar > .nav-logo-text > .text {
        font-style: normal;
    }

    /*.container>.sidebar {*/
    /*    width: 240px !important*/
    /*}*/

    .prop-panel {
        width: 140px !important;
    }

    .north .btn-group {
        margin-left: 10px;
        margin-top: 10px;
    }

    .header-container > table > thead[data-v-361dd7c7] {
        color: rgba(0, 0, 0, .85);
        font-size: 14px;
    }

    .header-container > table > thead > tr > th[data-v-361dd7c7] {
        height: 26px;
        /*font-weight: bold;*/
    }

    .header-container > table > thead > tr > th[data-v-361dd7c7] {
        /*font-weight: bold;*/
    }

    table.filter-open > thead > tr > th[data-v-361dd7c7] {
        padding-top: 1px;
    }

    .filter[data-v-361dd7c7] {
        padding: 2px 0 2px 0;
    }

    .grid > .grid-body table > tbody > tr > td > .body-cell {
        height: 25px;
    }

    .header-container > table > thead > tr > th > div.grid-header-title-wrapper[data-v-361dd7c7] {
        min-height: 24px;
    }

    table > thead > tr > th > .all-checkbox-container[data-v-361dd7c7] {
        padding: 6px 0;
    }

    table > thead > tr > th > .index-header-cell[data-v-361dd7c7] {
        padding: 1px 0;
    }

    /**
    单个tab也显示激活样式
     */
    /*    body.component .tab.only-one > .tab-header > .content-wrapper > ul > li.active {
            position: relative;
            border: none;
            font-size: 14px;
            color: #fff;
            font-weight: 600;
            background-color: var(--main-color);
        }*/

    /*    body.component .layout .region > .expand-collapse .expand-round span {
            position: relative;
            border: none;
            font-size: 14px;
            color: #fff;
            font-weight: 600;
            background-color: var(--main-color);
        }*/

    body, html {
        font-family: Microsoft YaHei, Serif;
    }

    .myTask-todo-num {
        position: absolute;
        top: -5px;
        right: -5px;
        background-color: #d40000;
        border-radius: 20px;
        padding: 0 4px;
        color: #fff;
    }

    /*    body.component .layout .region > .expand-collapse.vertical .expand-round span,
        body.component .layout .region > .expand-collapse.vertical .expand-round {
            background-color: var(--main-color);
        }*/
</style>